<?php
/**
 * Created by PhpStorm.
 * User: hg116
 * Date: 2018/12/5
 * Time: 21:23
 */

include "config.php";

if($_SERVER["REQUEST_METHOD"]=="POST"){
    if(isset($_REQUEST["uename"])&&isset($_REQUEST["uepwd"])){

        $uename=$_REQUEST["uename"];
        $uepwd=$_REQUEST["uepwd"];

        $sql="INSERT INTO `use_email` (`u_ename`,`u_pwd`) VALUE ('".$uename."','".$uepwd."');";

        $result=$conn->query($sql);

        if($result==1){
            print_r(json_encode(array("msg"=>"注册成功","status"=>1)));
        }else{
            print_r(json_encode(array("msg"=>"注册失败","status"=>0)));
        }
    }else{
        print_r(json_encode(array("msg"=>"密码或用户名不能为空","status"=>"-1")));
    }

}else{
    print_r(json_encode(array("msg"=>"不支持get请求","status"=>"-2")));
}